// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import vuex from 'vuex'
import $ from 'jquery'
import Print from 'vue-print-nb'
import 'animate.css'
import './style/style.css'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
Vue.use(Print)
Vue.use(iView)
Vue.config.productionTip = false


router.beforeEach((to, from, next) => {
        // ${//to and from are Route Object,next() must be called to resolve the hook}
        if (to.path == '/') {
            next()
        } else {
            if (localStorage.getItem('name')) {
                next()
            } else {
                next({ path: '/' })
            }
        }

    })
    /* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    template: '<App/>',
    components: { App }
})